#ifndef __FIFO_H__
#define __FIFO_H__

#include <stdint.h>



#define FIFO_BUF_SIZE 		256
#define ERR_FIFO_FULL 		0x01
#define ERR_FIFO_UNKNOW 	0x05

typedef struct
{
    unsigned char buf[FIFO_BUF_SIZE];
    int readIndex;
    int writeIndex;
}Fifo;


int             fifoAbs(int data);
void            fifoInitial(Fifo* fifo);
unsigned int    fifoCanReadSize(Fifo* fifo);
unsigned char   fifoRead(Fifo* fifo);
unsigned char 	fifoWrite(Fifo* fifo,unsigned char data);
unsigned char 	fifoWrite_multi(Fifo* fifo, uint8_t* src_addr, uint16_t num);
unsigned char   fifoCheckIndex(Fifo* fifo,unsigned int index);
void            fifoClear(Fifo* fifo);

extern int fifo_find(Fifo* fifo,unsigned char * str,unsigned int cmp_len,unsigned int total_len);

#endif
